import 'package:equatable/equatable.dart';

class CityModel with EquatableMixin {
  /// 地区/城市ID , 从父类继承
  String id;

  /// 地区/城市名称
  String? name;

  /// 地区/城市纬度
  String? lat;

  /// 地区/城市经度
  String? lon;

  /// 地区/城市的上级行政区划名称
  String? adm2;

  /// 地区/城市所属一级行政区域
  String? adm1;

  /// 地区/城市所属国家名称
  String? country;

  CityModel(this.id, {this.name, this.lat, this.lon, this.adm2, this.adm1, this.country});

  bool from(Map map) {
    id = map['id'];
    name = map['name'];
    lat = map['lat'];
    lon = map['lon'];
    adm2 = map['adm2'];
    adm1 = map['adm1'];
    country = map['country'];
    return true;
  }

  @override
  List<Object?> get props => [name, lat, lon, adm2, adm1, country];
}
